#!/usr/bin/env python
# -*- coding:utf-8 -*-

# file:主线程会等待子线程结束之后再结束.py
# author: 马国鑫
# datetime:2022/3/28 18:40
# software: PyCharm

"""
this is function  description 
"""

# import module your need

import threading
import time


def func():
    for i in range(5):
        time.sleep(0.2)
        print('func')



if __name__== '__main__':
    # 让子线程随着主线程的结束而结束
    # 方式一:
    # my_func = threading.Thread(target=func, daemon=True)

    # 方式二:
    my_func = threading.Thread(target=func)
    my_func.setDaemon(True)
    my_func.start()
    time.sleep(0.5)
    print('over')

